package com.ray.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ray.bean.WeiXinPeopleBean;
import com.ray.mapper.WeiXinPeopleMapper;


@Service
public class WeiXinPeopleService {

	@Autowired
	WeiXinPeopleMapper weiXinPeopleMapper;
	
	
	public List<WeiXinPeopleBean> getWeiXinPeopleByOpenId(String openId) {
		List<WeiXinPeopleBean> weiXinPeopleBean=weiXinPeopleMapper.getWeiXinPeopleByOpenId(openId);
		return weiXinPeopleBean;
	}

	public void insertWeiXinPeople(WeiXinPeopleBean wxpb) {
		weiXinPeopleMapper.insertWeiXinPeople(wxpb);
	}

	public void updateWeiXinPeople(WeiXinPeopleBean weiXinPeople) {
		weiXinPeopleMapper.updateWeiXinPeople(weiXinPeople);
		
	}


	public void deleteWeiXinPeopleByUserId(Map map) {
		weiXinPeopleMapper.deleteWeiXinPeopleByUserId(map);
	}
	 
	/**
	 * 通过userIds获取微信openId
	 */ 
	public List<String> getOpenIdByUserIds(Map map){
		return weiXinPeopleMapper.getOpenIdByUserIds(map);
	}
	
	/**
	 * 通过用户的id获取微信openId
	 * @param userId
	 * @return
	 */
	public List<String> getOpenIdByUserId(String userId){
		return weiXinPeopleMapper.getOpenIdByUserId(userId);
	}

	
	/**
	 * 通过用户id集合获取微信信息WeiXinPeopleBean
	 * @param userIdList(用户id集合)
	 * @return
	 */
	public List<WeiXinPeopleBean> getWeiXinPeopleByUserIdList(List<String> userIdList) {
		List<WeiXinPeopleBean> weiXinPeopleBean=weiXinPeopleMapper.getWeiXinPeopleByUserIdList(userIdList);
		return weiXinPeopleBean;
	}

	/**
	 * 移除微信绑定
	 * @param openid
	 */
	public void removeBindByOpenId(String openid) {
		weiXinPeopleMapper.removeBindByOpenId(openid);
	}
	
	/**
	 * 通过用户id获取用户微信信息
	 * @param userId
	 * @return
	 */
	public List<WeiXinPeopleBean> getWexinPeopleByUserId(String userId){
		return weiXinPeopleMapper.getWexinPeopleByUserId(userId);
	}
}
